
import { Badge, Button } from 'antd';

export const tableColumns = (
    PassCommrnt: (id: number, flag: boolean) => void,
    Recomment: (record: object) => void,
    DeleteComment: (id: number) => void) => {
    return [
        {
            title: '状态',
            dataIndex: 'pass',
            key: 'pass',
            render(text: boolean) {
                return text ? <span><Badge status="success" ></Badge> 通过</span> : <span><Badge status="warning" ></Badge> 未通过</span>
            }
        },
        {
            title: '称呼',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '联系方式',
            dataIndex: 'email',
            key: 'email',
        },
        {
            title: '原始内容',
            dataIndex: 'content',
            key: 'content',
        },
        {
            title: 'HTML内容',
            dataIndex: 'html',
            key: 'html',
        },
        {
            title: '管理文章',
            dataIndex: 'archive',
            key: 'archive',
        },
        {
            title: '创建时间',
            dataIndex: 'createAt',
            key: 'createAt',
        },
        {
            title: '父级评论',
            dataIndex: 'comm',
            key: 'comm',
        },
        {
            title: '操作',
            dataIndex: 'action',
            key: 'action',
            render: (_: any, record: any) => {
                // const id=record.id
                console.log(_, record)
                const id = record.id
                return (
                    <>
                        <Button type='link' onClick={()=> PassCommrnt(id,true)}>通过</Button>
                        <Button type='link'>拒绝</Button>
                        <Button type='link' onClick={()=>{Recomment(record)}}>回复</Button>
                        <Button type='link'>删除</Button>
                    </>
                )
            }
        }
    ];

}